from django.db import models

# Create your models here.

class UserInfo(models.Model):
    user_type_choices = (
        (1, "普通用户"),
        (2, "VIP"),
        (3, "SVIP"),
    )

    user_type = models.IntegerField(choices=user_type_choices, default=1)
    username = models.CharField(max_length=32, unique=True)
    password = models.CharField(max_length=64)

    class Meta:
        managed = True
        db_table = 'user_userinfo'


class UserToken(models.Model):
    #  user = models.ForeignKey(UserInfo, unique=True, on_delete=models.DO_NOTHING)
    user = models.OneToOneField(UserInfo, on_delete=models.DO_NOTHING)
    token = models.CharField(max_length=64)

    class Meta:
        managed = True
        db_table = 'user_usertoken'
